package singleton;

/**
 * 懒汉式，线程不安全
 * 该实现方式在运行时加载对象，这样带来了线程不安全问题
 */
public class SingleTon2 {

    private static SingleTon2 instance;

    private SingleTon2(){

    }

    public static SingleTon2 getInstance(){
        if(null == instance){
            try{
                Thread.sleep(1);
            }catch (Exception e){
                e.printStackTrace();
            }
            instance = new SingleTon2();
        }
        return instance;
    }
}
